package org.jeecg.modules.lab.entrust.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.lab.entrust.service.ILabProcessService;
import org.jeecg.modules.lab.entrust.vo.LabProcessPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


@Api(tags = "业务流程")
@RestController
@RequestMapping("/entrust/process")
@Slf4j
public class LabProcessController {

    @Autowired
    private ILabProcessService labProcessService;

    @ApiOperation(value = "业务流程-业务流程图", notes = "业务流程-业务流程图")
    @GetMapping(value = "/process")
    public Result<LabProcessPage> getProcess(@RequestParam(name = "entrustId", defaultValue = "") String entrustId,
                                             @RequestParam(name = "entrustType", defaultValue = "") String entrustType) {
        LabProcessPage labProcessPage = labProcessService.getProcessPage(entrustId, entrustType);

        if (labProcessPage == null) {
            return Result.error("未找到对应数据！");
        }
        return Result.OK(labProcessPage);
    }
}